﻿using BK.BlusinessLogic;
using BK.Model;
using BK.Repositories.Abstract;
using BK.Repositories.Factory;

using Lib.Utils.WorkerUtils;

namespace BK.Import
{
    [WorkerItem]
    public class FinancistoFilesWorkerItem : BaseExpenseFilesWorkerItem<FinancistoExpense, FinancistoFile, FinancistoFilesBl, IFinancistoFilesRepository>
    {
        public FinancistoFilesWorkerItem() 
            : base
            (
                RepositoryFactory.Get<IUsersRepository>(),
                RepositoryFactory.Get<IFinancistoFilesRepository>()
            )
        {
        }

        protected override FinancistoFilesBl DoCreateExpensesFilesBl(IFinancistoFilesRepository expensesFileRepository)
        {
            return new FinancistoFilesBl(expensesFileRepository);
        }

        protected override void DoBeforeDoExecute()
        {
            FinancistoExpense.ResetMappedProperties();
        }

        protected override void DoTieFileToUser(User user, FinancistoFile expensesFile)
        {
            UsersBl.Tie(user, expensesFile);
        }
    }
}